import { Component, OnInit, ViewChild, TemplateRef } from '@angular/core';
import { _HttpClient, ModalHelper } from '@delon/theme';
import { STColumn, STComponent, STData } from '@delon/abc';
import { SFSchema } from '@delon/form';
import { SPage, ColumnType } from '@shared/components/table-page/table-page.component';

@Component({
  selector: 'app-person-access-list',
  templateUrl: './person-access-list.component.html',
})
export class PersonAccessListComponent implements OnInit {
  @ViewChild('st', { static: false }) st: STComponent;
  config: SPage = {
    columns: [
      {
        index: 'id',
        title: '多选',
        type: ColumnType.checkbox,
      },
      {
        index: 'name',
        title: '人员姓名',
        filter: {
          placeholder: '请输入人员姓名',
          type: 'string'
        }
      },
      {
        index: 'sex',
        title: '性别',
        filter: {
          placeholder: '请选择性别',
          type: 'select',
          items: [
            { label: '男', value: '0' },
            { label: '女', value: '1' }
          ]
        }
      },
      {
        index: 'mobile',
        title: '手机号码',
        filter: {
          placeholder: '请输入手机号',
          type: 'string'
        }
      },
      {
        index: 'papersCode',
        title: '证件号码',
        filter: {
          placeholder: '请输入证件号码',
          type: 'string'
        }
      },
      {
        index: 'houseAddr',
        title: '房屋地址',
        filter: {
          placeholder: '请输入房屋地址',
          type: 'string'
        }
      },
      {
        index: 'houseCode',
        title: '房号',
        filter: {
          placeholder: '请输房号',
          type: 'string'
        }
      },
      {
        index: 'openDoorDate',
        title: '开门时间',
        filter: {
          placeholder: '请输入开门时间',
          type: 'string'
        }
      },
      {
        index: 'openDoorType',
        title: '开门方式',
        filter: {
          placeholder: '请选择开门方式',
          type: 'select',
          items:[
            {
              label:'APP开门',value:'1'
            },
            {
              label:'CPU卡',value:'2'
            },
            {
              label:'居住证',value:'3'
            },
            {
              label:'身份证',value:'4'
            }
          ]
        }
      },
      {
        index: 'picture',
        title: '实时照片',
        type:ColumnType.img
      },
    ],
    showCheckBox: true,
    editBtn:[
      {title:'查看出入信息'},
    ],
    data: [
      { name: '李四 ', ssyys: '天威', sex: 0, picture: 'http://hbimg.b0.upaiyun.com/029595f141559884e666bd60feab93912be79fd52d10-hQ1GHa_fw236' },
      { name: '王五 ', ssyys: '移动', sex: 1, picture: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1575440187&di=d266d656d7e00a5b10dd9b6d6ca2e618&imgtype=jpg&er=1&src=http%3A%2F%2Fimage.biaobaiju.com%2Fuploads%2F20181004%2F16%2F1538642576-tdTMaKogWs.jpg' },
      { name: '王五 ', ssyys: '移动', sex: 1, picture: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1575440187&di=d266d656d7e00a5b10dd9b6d6ca2e618&imgtype=jpg&er=1&src=http%3A%2F%2Fimage.biaobaiju.com%2Fuploads%2F20181004%2F16%2F1538642576-tdTMaKogWs.jpg' },
    ]
  }
  constructor(private http: _HttpClient, private modal: ModalHelper) { }

  ngOnInit() { }

  // 根据状态检索不需要被全选的数据
  dataProcess() {
    return this.config.data.map((i: STData, index: number) => {
      return i;
    });
  }
  // 操作区
  operate(e, element: TemplateRef<{}>): void {
    console.log(e);
    
  }
  // 选择数据
  selectChange(e) {
    console.log(e);
    
  }


}
